var AbstractDrawer = Class.extend({
    init: function(workspace){
        this._workspace = workspace;
        this._shapes = new Array();
    },
    getWorkspace: function(){
        return this._workspace;
    },
    getShapes: function(){
        return this._shapes;
    },
    draw : function(shape){
        //Must be overrided in child class
    },
    redraw: function(){
        //Must be overrided in child class
    },
    add: function(shape, options){

            this.getShapes().push(shape);
            shape.options = options != null ? options : {};

    },
    remove: function(shape){
        for(var i = 0; i < this.getShapes().length ; i++){
            if(shape === this.getShapes()[i]){
                this.getShapes().splice(i,1);
                delete shape["options"];
            }
        }
    },
    removeAll: function(){
        for(var i = 0; i < this.getShapes().length ; i++){
            this.remove(this.getShapes()[i]);
        }
    },
    getAttribute:function (shape, attribute){
        return shape.options[attribute];
    },
    setAttribute:function (shape, attribute, value){
        shape.options[attribute] =  value;
    },
    setAttributes:function (shape, attributes){
        for(var attribute in attributes){
            this.setAttribute(shape, attribute, attributes[attribute]);
        }
    }
});
